﻿using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
//using System.Web.DynamicData;
using OA.Model;
using OA.Model.MyAttribute;
using OA.Core;
using System;

namespace OA.Model
{
    [Table("Notice")]
    //[TableName("通知")]
    public class Notice : BaseInfo
    {
        public int Status { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [MaxLength(50)]
        [Display(Name = "标题")]
        [Tag(TagEnum.Text, "required", "标题", 2, 50)]
        public string Title { get; set; }

        /// <summary>
        ///  公告类型  通知  决定  通报 其他
        /// </summary>
        [Display(Name = "类型")]
        [Tag(TagEnum.Select, "required", "类型", "通知,决定,通报,其他")]
        public string Type { get; set; }
        
        /// <summary>
        /// 发送时间
        /// </summary>
        [Display(Name = "发送时间")]
        [Tag(TagEnum.DateTime, "required", "发送时间", 2, 20)]
        public DateTime SendTime{get;set;}

        /// <summary>
        /// 内容
        /// </summary>
        [Display(Name = "内容")]
        [Tag(TagEnum.RichTextEditor, "required", "内容", 2, 50)]
        public string Content { get; set; }

        /// <summary>
        /// 附件
        /// </summary>
        [Display(Name = "附件")]
        [Tag(TagEnum.MultipleFlieUpload, "required", "附件", 2, 20)]
        public string Attachment { get; set; }

        /// <summary>
        /// 置顶
        /// </summary>
        [Display(Name = "置顶")]
        [Tag(TagEnum.Switch, "required", "置顶", 2, 20)]
        public bool IsTop { get; set; }
        

    }

    public class SimpleNotice : SimpleInfo
    {
        public string Title { get; set; }

        public string Type { get; set; }

        public DateTime SendTime { get; set; }

        public string Content { get; set; }

        public string Attachment { get; set; }

        public bool IsTop { get; set; }

        public static Expression<Func<Notice, SimpleNotice>> Map = m => new SimpleNotice()
        {
            ID = m.ID,
            Title = m.Title,
            Type = m.Type,
            SendTime = m.SendTime,
            Content = m.Content,
            Attachment = m.Attachment,
            IsTop = m.IsTop,
            Status = m.Status
        };
    }


}
